package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC717 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public boolean isOneBitCharacter(int[] bits) {
            int i = 0;
            while (i < bits.length) {
                if (bits[i] == 0) {
                    if (i == bits.length - 1) return true;
                    else i++;
                } else {
                    i += 2;
                }
            }

            return false;
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.isOneBitCharacter(InputUtil.toIntegerArray("[1, 0, 0]")));
        System.out.println(solution.isOneBitCharacter(InputUtil.toIntegerArray("[1,1,1,0]")));
    }

    public static void main(String[] args) throws Exception {
        LC717 an = new LC717();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
